<template>
	<view>
		<textarea auto-height placeholder="请输入评论标题(字数限制150字)" v-model="title"></textarea>
		<textarea auto-height placeholder="请输入评论内容(字数限制150字)" v-model="content" style="margin-top: 50rpx;
		min-height: 400rpx;"></textarea>
		<button class="bu" style="margin-top: 40rpx;" :disabled="title === '' || content === '' ? true : false"
		@click="submit">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				content: ''
			};
		},
		methods: {
			submit(){
				this.$request({
					url: '/prod-api/api/common/feedback',
					method: 'POST',
					data:{
						title: this.title,
						content: this.content
					}
				}).then(res => {
					if(res.code === 200){
						uni.showToast({
							title:'提交成功'
						})
						setTimeout(() => {
							uni.switchTab({
								url:'/pages/user/user'
							})
						}, 1000)
					}else{
						uni.showToast({
							icon:'error',
							title:res.msg
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
view{
	padding: 20rpx;
	textarea{
		padding: 20rpx;
		margin: 20rpx auto;
		border: 2rpx solid #e4e7ed;
		border-radius: 10rpx;
		min-height: 80rpx;
	}
}
</style>
